import configparser as cf
from pathlib import Path
from typing import Union


class Config:
    def __init__(self, address: Union[Path, str]):
        self.conf_address = Path(address)
        self.conf = cf.ConfigParser()
        self.conf.read(self.conf_address)

    def __getitem__(self, item: tuple[str, str]) -> str:
        return self.conf.get(item[0], item[1])

if __name__ == '__main__':
    c = Config('../config.ini')
    port = c['Relay', 'port']
    print(port)
